package com.sl.core.engine.scripts;

import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum RelationalOperatorEnum {


    EQ("eq", "=", "等于"),
    NULL("", "", ""),
    Not_NULLL("IsNotNull","IS NOT NULL",""),
    IS_NULLL("IsNull","IS NULL",""),
    IS_NOT_EMPTY("IsNotEmpty","IS NOT EMPTY",""),
    IS_EMPTY("IsEmpty","IS EMPTY","")
    ;

    private String code;

    private String id;

    private String name;

    public static RelationalOperatorEnum ofCode(String code) {
        return Arrays.stream(values()).filter(v -> StrUtil.equalsAnyIgnoreCase(code, v.getCode())).findFirst().orElse(NULL);
    }
}
